{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": 11,
   "id": "a759cf2f",
   "metadata": {},
   "outputs": [],
   "source": [
    "class Student(object):\n",
    "    company = \"尚学堂\"\n",
    "    __compangy = \"百战尚学堂\"\n",
    "    count = 0\n",
    "    def __init__(self,temp_name,temp_age):\n",
    "        self.name = temp_name\n",
    "        self.age = temp_age\n",
    "        self.__string = \"str\"\n",
    "        Student.count +=1\n",
    "    \n",
    "    def change_age(self,new_age):\n",
    "        self.age = new_age\n",
    "    \n",
    "    def __call__(self,a):\n",
    "        if self.age+a>23:\n",
    "            return False\n",
    "        else:\n",
    "            return True\n",
    "    \n",
    "    def __add__(self,other):\n",
    "        return self.age+other.age"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 12,
   "id": "2adf907a",
   "metadata": {},
   "outputs": [],
   "source": [
    "s3=Student(\"askd\",45)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 13,
   "id": "96a7c53f",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "'百战尚学堂'"
      ]
     },
     "execution_count": 13,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "s3._Student__compangy"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 14,
   "id": "61fb2c51",
   "metadata": {},
   "outputs": [],
   "source": [
    "s1 = Student(\"张三\",18)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 15,
   "id": "86b1a142",
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "<__main__.Student object at 0x00000153A9C907C8>\n"
     ]
    }
   ],
   "source": [
    "print(s1)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 16,
   "id": "b54a7144",
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "21\n"
     ]
    }
   ],
   "source": [
    "s1.change_age(21)\n",
    "print(s1.age)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 17,
   "id": "adb01d42",
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "尚学堂\n",
      "2\n"
     ]
    }
   ],
   "source": [
    "print(Student.company)\n",
    "print(Student.count)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 18,
   "id": "4ead01bd",
   "metadata": {},
   "outputs": [],
   "source": [
    "s2=Student(\"asd\",23)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 19,
   "id": "a55dd46b",
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "3\n"
     ]
    }
   ],
   "source": [
    "print(Student.count)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 20,
   "id": "1fcf0043",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "True"
      ]
     },
     "execution_count": 20,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "s1(1)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 21,
   "id": "befe60a9",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "44"
      ]
     },
     "execution_count": 21,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "s1+s2"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 22,
   "id": "d5058646",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "True"
      ]
     },
     "execution_count": 22,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "isinstance(s1, Student)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 23,
   "id": "1ef9888b",
   "metadata": {},
   "outputs": [],
   "source": [
    "class new_student:\n",
    "    pass"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 24,
   "id": "6ac6dc0c",
   "metadata": {},
   "outputs": [],
   "source": [
    "s=new_student()\n",
    "s.score=99"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 25,
   "id": "5abe50c1",
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "99\n"
     ]
    }
   ],
   "source": [
    "print(s.score)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "6c40fd72",
   "metadata": {},
   "outputs": [],
   "source": [
    " "
   ]
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "my_test",
   "language": "python",
   "name": "my_test"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.7.10"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 5
}
